/**
 * @author MIAO
 * Created on 2011-10-7
 * For more information, please visit:ismiao.com
 */
package com.ismiao.spring.jdbcTemplate;

import org.junit.Test;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

public class TestJDBCTemplate {
	//直接用JUnit测试JDBCTemplate
	@Test
	public void tconnect() throws DataAccessException {
		DriverManagerDataSource dataSource = new DriverManagerDataSource();
		dataSource.setDriverClassName("com.mysql.jdbc.Driver");
		dataSource.setUrl("jdbc:mysql://localhost:3306/test");
		dataSource.setUsername("root");
		dataSource.setPassword("root");
		JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
		jdbcTemplate
				.update("UPDATE user SET userDesc = 'fuzhou' WHERE userID = 10001");
	}
}
